# -*- coding:utf-8 -*-
import json

def greet_user ():
    """问候用户，并指出名字"""

    file_name = "./read_file/greet.json"
    try:
        with open(file_name) as f_obj:
            user_name = json.load(f_obj)

    except FileNotFoundError:
        
        user_name = input("What's your name ? ")

        with open(file_name, 'w') as f_obj:
            json.dump(user_name, f_obj)
            print("We'll remember you when you come back, " + user_name + ' !!')

    else:
        print("Welcome back, " + user_name + " !!")
